// views/index/shop/translationcopy/ordermessage/placeanorderdetail/index.js
var BASE_URL = getApp().globalData.BASE_URL

Page({

  /**
   * 页面的初始数据
   */
  data: {
    id: '', //下单页面传回来的id
    user_name: '',
    spell: '',
    sex: 0,
    born: "yyyy/mm/日",
    tel: '',
    wechat: '',
    location: '',
    jiudu: '',
    zhuanye: '',
    du_time: 'yyyy/mm/日',
    education: '',
    use: "申请签证",
    apply: '商科',
    language: '德语',
    beizhu: '',
    email: "系统会自动将成功信息推送至2458339754@qq.com"
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var _this = this
    _this.setData({
      id: options.id
    })

    wx.request({
      url: `${BASE_URL}/fanyi/wenshuDataNext`,
      method: "POST",
      data: {
        type: 'xiaochengxv',
        id: _this.data.id
      },
      header: {
        'Content-Type': 'application/json' //GET方式是这个
      },
      success(res) {
        res.data.list.fuwu_info = JSON.parse(res.data.list.fuwu_info)
        _this.setData({
          user_name: res.data.list.user_name,
          spell: res.data.list.spell,
          sex: res.data.list.sex == 1 ? '男' : '女',
          born: res.data.list.born,
          tel: res.data.list.tel,
          wechat: res.data.list.wechat,
          location: res.data.list.location,
          jiudu: res.data.list.jiudu,
          zhuanye: res.data.list.zhuanye,
          du_time: res.data.list.du_time,
          education: res.data.list.education,
          use: res.data.list.fuwu_info.use,
          apply: res.data.list.fuwu_info.apply,
          language: res.data.list.fuwu_info.language,
          beizhu: res.data.list.beizhu == '' ? '无备注' : res.data.list.beizhu,
          email: '系统会自动将成功信息推送至' + res.data.list.email
        })
        console.log(res)
      }
    })
  },
  nextstep: function () {
    var _this = this
    var userinfo = wx.getStorageSync("USER")
    wx.request({
      url: `${BASE_URL}/fanyi/wenshudatanextsave`,
      method: "get",
      data: {
        openid: userinfo.openid,
        uid: userinfo.id,
        type: 'xiaochengxv',
        id: _this.data.id
      },
      header: {
        'Content-Type': 'application/json' //GET方式是这个
      },
      success(res) {
        wx.navigateTo({
          url: `../paypage/index?id=${res.data.id}`
        })
      }
    })
  },





















  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },


})